<?php
/*
 * Get all the people who tried the recipe
 */

F3::call('authentication.php');
if (F3::exists('auth_error'))
{
  // authentication failed
  return;
}

$rid = F3::get('PARAMS["recipe_id"]');

$param = array('1'=>$rid);

$result = DB::sql("SELECT * from ratings where rid = ?", $param);

$response = array();

foreach($result as $a){
	$b =array();
	$b['id'] = $a['uid'];
	$b['rating'] = $a['rating'];
	$b['timestamp'] = $a['timestamp'];
	array_push($response, $b);
}

header('HTTP/1.1 200');
header("Content-Type: application/json");
echo json_encode($response);
?>